/*
 * (C) 2012
 * Use union to get byte order 
 */  

#include <stdio.h>

union byte_tag
{
	int whole;
	struct { char c0; char c1; char c2; char c3; } byte;
};

int main()
{
	union byte_tag br;
	br.whole = 0x12345678;
	printf("The integer is: %x\n", br.whole);
	printf("The four bytes are(from low to high): %x %x %x %x\n", br.byte.c0, br.byte.c1, br.byte.c2, br.byte.c3);

	return 0;
}
